#pragma once

#include <opencv2/core/core.hpp>
#include <TuioServer.h>
#include "Contact.h"

class ContactManager
{
public:
	ContactManager(bool showGui = true);
	~ContactManager();

	void init(const cv::Mat& imgCurrent);
	void update(const cv::Mat& imgCurrent);

private:
	bool showGui;
	TUIO::TuioServer* server;

	// parameters
	float paramBlurSize;
	float paramThreshold;
	float rectifyXMin;
	float rectifyXMax;
	float rectifyYMin;
	float rectifyYMax;

	cv::Mat imgBackground;
	cv::Mat imgWorkingA;
	cv::Mat imgWorkingB;
	int idCounter;
	ContactVector contacts;

	ContactPtr updateContact(const cv::RotatedRect& ellipse);
};

